#!/bin/bash

mkdir -p /data/zookeeper

node=${hostname}

echo "current node: ${node}"

# [[ ! -e /data/zookeeper/myid ]] && echo "1" > /data/zookeeper/myid

echo "`nslookup zk1|grep -v 127.0.0.1|awk '/Address/{print $2}'` zk1" >> /etc/hosts
echo "`nslookup zk2|grep -v 127.0.0.1|awk '/Address/{print $2}'` zk2" >> /etc/hosts
echo "`nslookup zk3|grep -v 127.0.0.1|awk '/Address/{print $2}'` zk3" >> /etc/hosts


cd $ZK_HOME/bin && zkServer.sh start


tail -f 